package com.Liux.dao;

import Liux.dao.BlogMapper;
import Liux.pojo.Blog;
import Liux.utils.IDUtils;
import Liux.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.Date;

public class addInitBlog {

    @Test
    public void add(){
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        BlogMapper mapper = sqlSession.getMapper(BlogMapper.class);

        Blog blog = new Blog();
        blog.setId(IDUtils.getId());
        blog.setTitle("第一----");
        blog.setAuthor("Liux");
        blog.setCreateTime(new Date());
        blog.setViews(9999);

        mapper.addBlog(blog);

        blog.setId(IDUtils.getId());
        blog.setTitle("第二===");
        mapper.addBlog(blog);

        blog.setId(IDUtils.getId());
        blog.setTitle("地上；；；；");
        mapper.addBlog(blog);

        blog.setId(IDUtils.getId());
        blog.setTitle("第五itt");
        mapper.addBlog(blog);

        sqlSession.close();
    }
}
